/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package dominio;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author jair
 */
@Entity
@Table(name = "Professores")
public class Professores implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @NotNull
    @Column(name = "Codigo_Professor")
    private Integer id;
    
    @NotNull
    @Size(min = 1, max = 40)
    @Column(name = "Nome_Professor")
    private String nomeProfessor;
    
    @Size(max = 30)
    @Column(name = "usuario")
    private String usuario;
    
    @Size(max = 8)
    @Column(name = "senha")
    private String senha;
    
    @OneToMany(mappedBy = "professor", fetch = FetchType.LAZY)
    private Set<TurmaDisciplina> turmaDisciplina = new HashSet<>();

    public Professores() { 
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNomeProfessor() {
        return nomeProfessor;
    }

    public void setNomeProfessor(String nomeProfessor) {
        this.nomeProfessor = nomeProfessor;
    }

    public String getUsuario() {
        return usuario;
    }

    public void setUsuario(String usuario) {
        this.usuario = usuario;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public Set<TurmaDisciplina> getTurmaDisciplina() {
        return turmaDisciplina;
    }

    public void setTurmaDisciplina(Set<TurmaDisciplina> turmaDisciplina) {
        this.turmaDisciplina = turmaDisciplina;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + Objects.hashCode(this.id);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Professores other = (Professores) obj;
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        return true;
    }

    
}
